<?php

namespace App\Controller\InsideService;

use App\Model\QmGameList;
use App\Service\ExcelService;
use Exception;
use Psr\Http\Message\ResponseInterface;

class GiftInside extends BaseInside {
    /**
     * 获取列表
     * @param string $size
     * @param string $game_hash
     * @param int $page
     * @return array
     */
    public function index(string $size = '', string $game_hash = '', int $page = 1): array {
        return $this->getInfo('Gift/index', [
            'page'      => $page,
            'size'      => $size,
            'game_hash' => $game_hash
        ]);
    }

    /**
     * 编辑
     * @param $data
     * @return mixed
     */
    public function edit($data): mixed {
        return $this->postInfo('Gift/edit', $data);
    }

    /**
     * 删除
     * @param string $id
     * @return array
     */
    public function del(string $id = ''): array {
        return $this->getInfo('Gift/del', [
            'id' => $id
        ]);
    }

    /**
     * 新增
     * @param $data
     * @return mixed
     */
    public function add($data): mixed {
        return $this->postInfo('Gift/add', $data);
    }

    /**
     * 获取列表
     * @param string $size
     * @param string $gift_bag_id
     * @param string $openid
     * @param int $page
     * @param string $game_hash
     * @return array
     */
    public function code(string $size = '', string $gift_bag_id = '', string $openid = '', int $page = 1, string $game_hash = ''): array {
        return $this->getInfo('Gift/code', [
            'page'        => $page,
            'size'        => $size,
            'gift_bag_id' => $gift_bag_id,
            'openid'      => $openid,
            'game_hash'   => $game_hash
        ]);
    }

    /**
     * 获取列表
     * @param string $number
     * @param string $gift_bag_id
     * @param string $game_hash
     * @return array
     */
    public function buildCode(string $number = '', string $gift_bag_id = '', string $game_hash = ''): array {
        return $this->getInfo('Gift/buildCode', [
            'number'      => $number,
            'gift_bag_id' => $gift_bag_id,
            'game_hash'   => $game_hash,
        ]);
    }
}